<?php

namespace App\Http\Controllers\Develop;

use App\Models\User\User;

use Illuminate\Http\Request;

use App\Http\Controllers\Controller;

use Illuminate\Support\Facades\Redis as Redis;

class DevelopController extends Controller
{

    public function main(Request $request)
    {

        $menu_id = $request->input('menu');
        if (empty($menu_id)) {
            $menu_id = 'console';
        }

        //获取当前用户id
        $userId = Redis::get('WDH_ADMIN_USER_ID_' . session_id());

        //查询用户信息
        $user = User::find($userId);

        $menus = [

            'console' => [
                [
                    'name' => '权限',
                    'sub' => [
                        [
                            'name' => '权限组',
                            'link' => '/lar/develop/permission/group',
                        ],
                        [
                            'name' => '权限',
                            'link' => '/lar/develop/permission',
                        ]
                    ]
                ],
                [
                    'name' => '流水号',
                    'sub' => [
                        [
                            'name' => '流水号',
                            'link' => '/lar/develop/seqno',
                        ],
                    ]
                ],
//                [
//                    'name' => '日志',
//                    'sub' => [
//                        [
//                            'name' => '日志',
//                            'link' => '/lar/develop/log',
//                        ],
//                    ]
//                ],
                [
                    'name' => '任务',
                    'sub' => [
                        [
                            'name' => '任务',
                            'link' => '/lar/develop/task',
                        ],
                    ]
                ],
                [
                    'name' => '微信TOKEN',
                    'sub' => [
                        [
                            'name' => '微信ACCESS TOKEN',
                            'link' => '/lar/develop/access',
                        ],
                    ]
                ],
                [
                    'name' => '模块管理',
                    'sub' => [
                        [
                            'name' => '模块',
                            'link' => '/lar/develop/module',
                        ],
                        [
                            'name' => '模块样式库',
                            'link' => '/lar/develop/module/style',
                        ],
                    ]
                ],
            ],

            'setting' => [
                [
                    'name' => '公共设置',
                    'sub' => [
                        [
                            'name' => '公共设置',
                            'link' => '/lar/develop/function/20',
                        ],
                        [
                            'name' => '后台用户设置',
                            'link' => '/lar/develop/function/11',
                        ],
                        [
                            'name' => '支付方式设置',
                            'link' => '/lar/develop/function/9',
                        ],
                    ]
                ],
                [
                    'name' => '会员设置',
                    'sub' => [
                        [
                            'name' => '会员设置',
                            'link' => '/lar/develop/function/18',
                        ],
                        [
                            'name' => '积分设置',
                            'link' => '/lar/develop/function/2',
                        ],
                        [
                            'name' => '会员资料设置',
                            'link' => '/lar/develop/function/17',
                        ],
                        [
                            'name' => '会员开卡设置',
                            'link' => '/lar/develop/function/22',
                        ],
                        [
                            'name' => '会员绑卡设置',
                            'link' => '/lar/develop/function/23',
                        ],
                        [
                            'name' => '会员充值设置',
                            'link' => '/lar/develop/function/3',
                        ],
                        [
                            'name' => '用户注册协议',
                            'link' => '/lar/develop/function/44',
                        ],
                    ]
                ],
                [
                    'name' => '商城设置',
                    'sub' => [
                        [
                            'name' => '商城设置',
                            'link' => '/lar/develop/function/43',
                        ],
                        [
                            'name' => '短信设置',
                            'link' => '/lar/develop/function/36',
                        ],
                        [
                            'name' => '购物车设置',
                            'link' => '/lar/develop/function/14',
                        ],
                        [
                            'name' => '百度设置',
                            'link' => '/lar/develop/function/7',
                        ],
                    ]
                ],
                [
                    'name' => '订单设置',
                    'sub' => [
                        [
                            'name' => '订单设置',
                            'link' => '/lar/develop/function/21',
                        ],
                        [
                            'name' => '拆单设置',
                            'link' => '/lar/develop/function/1',
                        ],
                        [
                            'name' => '退货设置',
                            'link' => '/lar/develop/function/4',
                        ],
                        [
                            'name' => '配送时间设置',
                            'link' => '/lar/develop/function/12',
                        ],
                        [
                            'name' => '提货时间设置',
                            'link' => '/lar/develop/function/13',
                        ],
                        [
                            'name' => '取消原因设置',
                            'link' => '/lar/develop/function/37',
                        ],
                        [
                            'name' => '拒收原因设置',
                            'link' => '/lar/develop/function/38',
                        ],
                        [
                            'name' => '批发配送时间设置',
                            'link' => '/lar/develop/function/35',
                        ],
                    ]
                ],
                [
                    'name' => '商品设置',
                    'sub' => [
                        [
                            'name' => '商品设置',
                            'link' => '/lar/develop/function/30',
                        ],
                        [
                            'name' => '仓库管理设置',
                            'link' => '/lar/develop/function/34',
                        ],
                    ]
                ],
                [
                    'name' => '门店设置',
                    'sub' => [
                        [
                            'name' => '门店设置',
                            'link' => '/lar/develop/function/8',
                        ],
                    ]
                ],
                [
                    'name' => '卡券设置',
                    'sub' => [
                        [
                            'name' => '卡券设置',
                            'link' => '/lar/develop/function/45',
                        ],

                    ]
                ],
                [
                    'name' => '渠道设置',
                    'sub' => [
                        [
                            'name' => '微信设置',
                            'link' => '/lar/develop/function/41',
                        ],
                        [
                            'name' => '小程序设置',
                            'link' => '/lar/develop/function/50',
                        ],
                        [
                            'name' => '支付宝服务窗设置',
                            'link' => '/lar/develop/function/42',
                        ],

                    ]
                ],
                [
                    'name' => 'APP版本设置',
                    'sub' => [
                        [
                            'name' => 'APP版本设置',
                            'link' => '/lar/develop/app',
                        ],
                    ]
                ],
            ],

            'checkout'=>[
                [
                    'name' => '商城设置',
                    'sub' => [
                        [
                            'name' => '商城设置',
                            'link' => '/lar/develop/checkout/common/1',
                        ],
                    ]
                ],
                [
                    'name' => '虚拟商品设置',
                    'sub' => [
                        [
                            'name' => '虚拟商品设置',
                            'link' => '/lar/develop/checkout/common/2',
                        ],
                    ]
                ],
                [
                    'name' => '预售设置',
                    'sub' => [
                        [
                            'name' => '预售设置',
                            'link' => '/lar/develop/checkout/common/3',
                        ],
                    ]
                ],
                [
                    'name' => '积分兑换设置',
                    'sub' => [
                        [
                            'name' => '积分兑换设置',
                            'link' => '/lar/develop/checkout/common/4',
                        ],
                    ]
                ],
            ],

            'log' => [
                [
                    'name' => '日志管理',
                    'sub' => [
                        [
                            'name' => '日志清除',
                            'link' => '/lar/develop/log',
                        ],
                        [
                            'name' => '订单日志',
                            'link' => '/lar/develop/log/bill/refund',
                        ],
                    ]
                ]
            ]
        ];

        $left_menus = $menus[$menu_id];

        $data = [
            'user_name' => $user->trueName,
            'menu_id' => $menu_id,
            'left_menus' => $left_menus,
            'domain_name' => $request->getSchemeAndHttpHost()
        ];

        return view('develop/main', $data);
        
    }

    public function index()
    {
        return '首页';
    }

}
